import os
import re
import numpy as np


def to_bool_charactor(c):
    if c=='1':
        return True
    else:
        return False
def to_bool_string(s):
    return[to_bool_charactor(x) for x in s]

def file2matrix(path):
    fp=open(path,'r')
    content=fp.read()
    rowlist=content.splitlines()
    x=np.array([to_bool_string(x) for x in rowlist])
    
    return x


def to_char_bool(bool):
    if bool:
        return '1'
    else:
        return '0'

def to_string_boollist(boollist):
    temp=[to_char_bool(x) for x in boollist]    
    return ''.join(temp)